/*
 * Selling Partner API for Easy Ship
 *
 * Use the Selling Partner API for Easy Ship to build applications for sellers to manage and ship Amazon Easy Ship orders. With this API, you can get available time slots, schedule and reschedule Easy Ship orders, and print shipping labels, invoices, and warranties. To review the differences in Easy Ship operations by marketplace, refer to [Marketplace support](https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support).
 *
 * The version of the OpenAPI document: 2022-03-23
 * Generated by: https://github.com/openapitools/openapi-generator.git
 */


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = software.amzn.spapi.Client.OpenAPIDateConverter;

namespace software.amzn.spapi.Model.easyship.v2022_03_23
{
    /// <summary>
    /// A time window to hand over an Easy Ship package to Amazon Logistics.
    /// </summary>
    [DataContract(Name = "TimeSlot")]
    public partial class TimeSlot : IValidatableObject
    {

        /// <summary>
        /// Gets or Sets HandoverMethod
        /// </summary>
        [DataMember(Name = "handoverMethod", EmitDefaultValue = false)]
        public HandoverMethod? HandoverMethod { get; set; }
        /// <summary>
        /// Initializes a new instance of the <see cref="TimeSlot" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected TimeSlot() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="TimeSlot" /> class.
        /// </summary>
        /// <param name="slotId">A string of up to 255 characters. (required).</param>
        /// <param name="startTime">A datetime value in ISO 8601 format..</param>
        /// <param name="endTime">A datetime value in ISO 8601 format..</param>
        /// <param name="handoverMethod">handoverMethod.</param>
        public TimeSlot(string slotId = default(string), DateTime startTime = default(DateTime), DateTime endTime = default(DateTime), HandoverMethod? handoverMethod = default(HandoverMethod?))
        {
            // to ensure "slotId" is required (not null)
            if (slotId == null)
            {
                throw new ArgumentNullException("slotId is a required property for TimeSlot and cannot be null");
            }
            this.SlotId = slotId;
            this.StartTime = startTime;
            this.EndTime = endTime;
            this.HandoverMethod = handoverMethod;
        }

        /// <summary>
        /// A string of up to 255 characters.
        /// </summary>
        /// <value>A string of up to 255 characters.</value>
        [DataMember(Name = "slotId", IsRequired = true, EmitDefaultValue = true)]
        public string SlotId { get; set; }

        /// <summary>
        /// A datetime value in ISO 8601 format.
        /// </summary>
        /// <value>A datetime value in ISO 8601 format.</value>
        [DataMember(Name = "startTime", EmitDefaultValue = false)]
        public DateTime StartTime { get; set; }

        /// <summary>
        /// A datetime value in ISO 8601 format.
        /// </summary>
        /// <value>A datetime value in ISO 8601 format.</value>
        [DataMember(Name = "endTime", EmitDefaultValue = false)]
        public DateTime EndTime { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("class TimeSlot {\n");
            sb.Append("  SlotId: ").Append(SlotId).Append("\n");
            sb.Append("  StartTime: ").Append(StartTime).Append("\n");
            sb.Append("  EndTime: ").Append(EndTime).Append("\n");
            sb.Append("  HandoverMethod: ").Append(HandoverMethod).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public virtual string ToJson()
        {
            return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            // SlotId (string) maxLength
            if (this.SlotId != null && this.SlotId.Length > 255)
            {
                yield return new ValidationResult("Invalid value for SlotId, length must be less than 255.", new [] { "SlotId" });
            }

            // SlotId (string) minLength
            if (this.SlotId != null && this.SlotId.Length < 1)
            {
                yield return new ValidationResult("Invalid value for SlotId, length must be greater than 1.", new [] { "SlotId" });
            }

            yield break;
        }
    }

}
